void maximum(int x, int* pmax, int* pmin)
{
    *pmax = -0x3f3f3f3f;
    *pmin = 0x3f3f3f3f;
    while (x > 0)
    {
        int tmp = x % 10;
        if (tmp > *pmax)
            *pmax = tmp;
        if (tmp < *pmin)
            *pmin = tmp;
        x /= 10;
    }
}